Skip to content
  • 0 Votes
    5 Posts
    22k Views
    JonBJ

    @kshegunov
    Thank you for confirming that the principle is correct. I am presently debugging and discovering that the Quit button has nothing to do with the self.actionQuit = QtWidgets.QAction("Quit", self), and has some overridden code elsewhere such that it is doing its own QtWidgets.QApplication.exit() and is not connected to self.close() and hence self.closeEvent() at all :( Hence the lack of behaviour.

    I will complete this post in a few minutes, having solved the issue for me. Thank you for your help.

    EDIT: So the code I inherited declared an actionQuit and connected to a callback (just to fool me), but never actually created it in the menu via self.toolbar.addAction(self.actionQuit). The Quit button had code in a different module(!) to just do QtWidgets.QApplication.exit(), no "closing" at all. Once I traced this down I have made it call close() on main window instead and now all is well with that invoking closeEvent().

    Not my fault existing code is a labyrinthine mess, and I'm new to Qt & Python! Thanks for all help.

  • 0 Votes
    9 Posts
    3k Views
    SGaistS

    One thing to add to @kshegunov, terminating these applications ungracefully may have side effects on the stability of your system.